﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VsxFactory.Modeling.Strategies;
using VsxFactory.Modeling.VisualStudio;
using System.Diagnostics;

namespace VsxFactory.Repository.StrategiesGallery
{
    internal class ServerStrategyContext : StrategyContext
    {
        class ServerServiceProvider : IServiceProvider
        {
            public object GetService(Type serviceType)
            {
                return null;
            }
        }

        internal ServerStrategyContext()
            : base(new ServerServiceProvider())
        {
        }

        public override IProgressDialog ShowProgressDialog(string title, string text)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Affichage d'un message dans le log
        /// </summary>
        /// <param name="format">Format du message</param>
        /// <param name="parms">Paramètres du format de message</param>
        public override void WriteLogMessage(string format, params object[] parms)
        {
            System.Diagnostics.Contracts.Contract.Requires(!String.IsNullOrWhiteSpace(format));

            Trace.TraceInformation(format, parms);
        }

        public override void ClearErrors()
        {
        }

        /// <summary>
        /// Affiche une erreur
        /// </summary>
        /// <param name="format">Format du message</param>
        /// <param name="parms">Paramètres du format de message</param>
        public override void WriteError(string format, params object[] parms)
        {
            System.Diagnostics.Contracts.Contract.Requires(!String.IsNullOrWhiteSpace(format));

            Trace.TraceError(format, parms);
        }

        public override bool PromptYesNo(string text)
        {
            return true;
        }

        protected override Modeling.Repository.IStandardPackageRepository CreateLocalRepository() {
        return null;
        }

        protected override Modeling.Repository.ReferencePackageRepository CreateSolutionRepository() {
            return null;
        }

        public override IStrategySettings Settings
        {
            get { return new ServerSettings(); }
        }

        public override IVsSolutionExplorer SolutionExplorer
        {
            get {
#if DEBUG
                throw new NotImplementedException();
#endif
                return null;
            }
        }
    }
}